Enhanced java array

ABSTRACT

A method for creating an enhanced array is provided. An enhanced compiler generates an instrumented class file for an enhanced array class. The enhanced array class comprises at least one element class. The enhanced runtime loads the instrumented class file of the enhanced array class. The enhanced runtime loads a class file corresponding to the element class of the enhanced array class, and builds an internal data structure corresponding to the enhanced array class. An amount of memory storage is calculated for storing the enhanced array instance, and the amount of memory storage is allocated.

Aspects of the present invention have been disclosed by the Applicant,who obtained the subject matter disclosed directly from the inventors,in the product IBM SDK, Java Technology Edition Version 7 Release 1,made available to the public on Jun. 15, 2013.

FIELD OF THE INVENTION

This disclosure relates generally to data structures used withprogramming language objects in a data processing system and morespecifically to creating an enhanced Java® array in a program in thedata processing system.

BACKGROUND

Most high-level programming languages, such as C and C++, provide aconstruct, called an array, which consists of a fixed number of memorylocations of a single data type, for example, integers. Each memorylocation, or element of the array, is accessed by a numerical indexrepresenting the element's relative position in the array. However, inthe Java® programming language an array is an object, and the arrayelements each point to a separate object that contains the element data,rather than pointing to the element data directly. As a consequence ofthe Java® language architecture, arrays have limitations, particularlyin inefficient storage usage and performance overhead, not inherent inother programming languages. Current attempts to improve the Java® arrayimplementation include adding a wrapper class that references the Java®array. While this allows customizable behavior, such as user-definedmethods, the inefficient storage usage and performance issues remain. Inanother alternative, a custom application program interface (API) may bewritten to manipulate a raw byte buffer, thus simulating an array ofdata elements. However, memory usage and performance issues persist,since the objects created in this way are not entitled for the garbagecollection process provided by the programming language.

As previously stated, working within the present Java® language toimplement more robust array management features may have, as aconsequence, performance implications. As such, it may be advantageous,among other things, to implement an enhanced Java® array as a Java®class, thus allowing the enhanced Java® array the behavior and featuresinherent in the Java® class generally, and thus enabling greaterflexibility when working with memory structures while maintaining anencapsulated design.

Java and all Java-based trademarks and logos are trademarks orregistered trademarks of Oracle and/or its affiliates.

SUMMARY

According to one embodiment, a method for creating an enhanced arraycomprises: generating, by an enhanced compiler, an instrumented classfile for an enhanced array class, whereby the enhanced array classcomprises at least one element class; loading, by an enhanced runtime,the instrumented class file, whereby the instrumented class filecorresponds to the enhanced array class; loading, by the enhancedruntime, a class file corresponding to the at least one element class ofthe enhanced array class; building, by the enhanced runtime, an internaldata structure corresponding to the enhanced array class; calculating,by the enhanced runtime, an amount of memory storage required to storean instance of the enhanced array class; and allocating, by the enhancedruntime, the calculated amount of memory storage required to store theinstance of the enhanced array class.

According to another embodiment, a computer program product for creatingan enhanced array comprises: a computer readable storage medium readableby a processing circuit and storing instructions for execution by theprocessing circuit for performing a method comprising: generating, by anenhanced compiler, an instrumented class file for an enhanced arrayclass, whereby the enhanced array class comprises at least one elementclass; loading, by an enhanced runtime, the instrumented class file,whereby the instrumented class file corresponds to the enhanced arrayclass; loading, by the enhanced runtime, a class file corresponding tothe at least one element class of the enhanced array class; building, bythe enhanced runtime, an internal data structure corresponding to theenhanced array class; calculating, by the enhanced runtime, an amount ofmemory storage required to store an instance of the enhanced arrayclass; and allocating, by the enhanced runtime, the calculated amount ofmemory storage required to store the instance of the enhanced arrayclass.

According to another embodiment, a computer system for creating anenhanced array comprising one or more processors, one or morecomputer-readable storage devices, and a plurality of programinstructions stored on at least one of the one or more storage devicesfor execution by at least one of the one or more processors, theplurality of program instructions comprises: a computer readable storagemedium readable by a processing circuit and storing instructions forexecution by the processing circuit for performing a method comprising:generating, by an enhanced compiler, an instrumented class file for anenhanced array class, whereby the enhanced array class comprises atleast one element class; loading, by an enhanced runtime, theinstrumented class file, whereby the instrumented class file correspondsto the enhanced array class; loading, by the enhanced runtime, a classfile corresponding to the at least one element class of the enhancedarray class; building, by the enhanced runtime, an internal datastructure corresponding to the enhanced array class; calculating, by theenhanced runtime, an amount of memory storage required to store aninstance of the enhanced array class; and allocating, by the enhancedruntime, the calculated amount of memory storage required to store aninstance of the enhanced array class.

BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWINGS

For a more complete understanding of this disclosure, reference is nowmade to the following brief description, taken in conjunction with theaccompanying drawings and detailed description, wherein like referencenumerals represent like parts.

FIG. 1 is a block diagram of an exemplary data processing systemoperable for various embodiments of the disclosure;

FIG. 2 is a block diagram of an annotation system, in accordance withvarious embodiments of the disclosure;

FIG. 3A is a tabular representation of the relationship between theentities that represent a non-array object;

FIG. 3B is a tabular representation of the relationship between theentities that represent an array object, in accordance with oneembodiment of the disclosure;

FIG. 4 is an exemplary process for creating an array class, using theannotation system of FIG. 2, in accordance with one embodiment of thedisclosure; and

FIG. 5 is a schematic block diagram of hardware and software of thecomputer environment according to an embodiment of the process of FIG.4.

DETAILED DESCRIPTION

Although an illustrative implementation of one or more embodiments isprovided below, the disclosed systems and/or methods may be implementedusing any number of techniques. This disclosure should in no way belimited to the illustrative implementations, drawings, and techniquesillustrated below, including the exemplary designs and implementationsillustrated and described herein, but may be modified within the scopeof the appended claims along with their full scope of equivalents.

The present disclosure relates generally to field of data structuresused with programming languages, and more particularly to creating anenhanced Java® array in a program in a data processing system. Java andall Java-based trademarks and logos are trademarks or registeredtrademarks of Oracle and/or its affiliates. The following describedexemplary embodiments provide a system, method and program product toprovide an enhanced Java array that would: support array-likeoperations; customizable behavior (i.e., user-defined methods);Java-centric declarations; and elements of complex types.

As will be appreciated by one skilled in the art, aspects of the presentdisclosure may be embodied as a system, method or computer programproduct. Accordingly, aspects of the present disclosure may take theform of an entirely hardware embodiment, an entirely software embodiment(including firmware, resident software, micro-code, etc.) or anembodiment combining software and hardware aspects that may allgenerally be referred to herein as a “circuit”, “module”, or “system”.Furthermore, aspects of the present invention may take the form of acomputer program product embodied in one or more computer readablemedium(s) having computer readable program code embodied thereon.

Aspects of the present disclosure are described below with reference toflowchart illustrations and/or block diagrams of methods, apparatus,(systems), and computer program products according to embodiments of theinvention. It will be understood that each block of the flowchartillustrations and/or block diagrams, and combinations of blocks in theflowchart illustrations and/or block diagrams, can be implemented bycomputer program instructions.

Turning now to FIG. 1 a block diagram of an exemplary data processingsystem operable for various embodiments of the disclosure is presented.In this illustrative example, data processing system 100 includescommunications fabric 102, which provides communications betweenprocessor unit 104, memory 106, persistent storage 108, communicationsunit 110, input/output (I/O) unit 112, and display 114.

Processor unit 104 serves to execute instructions for software that maybe loaded into memory 106. Processor unit 104 may be a set of one ormore processors or may be a multi-processor core, depending on theparticular implementation. Further, processor unit 104 may beimplemented using one or more heterogeneous processor systems in which amain processor is present with secondary processors on a single chip. Asanother illustrative example, processor unit 104 may be a symmetricmulti-processor system containing multiple processors of the same type.

Memory 106 and persistent storage 108 are examples of storage devices116. A storage device is any piece of hardware that is capable ofstoring information, such as, for example without limitation, data,program code in functional form, and/or other suitable informationeither on a temporary basis and/or a permanent basis. Memory 106, inthese examples, may be, for example, a random access memory or any othersuitable volatile or non-volatile storage device. Persistent storage 108may take various forms depending on the particular implementation. Forexample, persistent storage 108 may contain one or more components ordevices. For example, persistent storage 108 may be a hard drive, aflash memory, a rewritable optical disk, a rewritable magnetic tape, orsome combination of the above. The media used by persistent storage 108also may be removable. For example, a removable hard drive may be usedfor persistent storage 108.

Communications unit 110, in these examples, provides for communicationswith other data processing systems or devices. In these examples,communications unit 110 is a network interface card. Communications unit110 may provide communications through the use of either or bothphysical and wireless communications links.

Input/output unit 112 allows for input and output of data with otherdevices that may be connected to data processing system 100. Forexample, input/output unit 112 may provide a connection for user inputthrough a keyboard, a mouse, and/or some other suitable input device.Further, input/output unit 112 may send output to a printer. Display 114provides a way to display information to a user.

Instructions for the operating system, applications and/or programs maybe located in storage devices 116, which are in communication withprocessor unit 104 through communications fabric 102. In theseillustrative examples the instructions are in a functional form onpersistent storage 108. These instructions may be loaded into memory 106for execution by processor unit 104. The processes of the differentembodiments may be performed by processor unit 104 usingcomputer-implemented instructions, which may be located in a memory,such as memory 106.

These instructions are referred to as program code, computer usableprogram code, or computer readable program code that may be read andexecuted by a processor in processor unit 104. The program code in thedifferent embodiments may be embodied on different physical or tangiblecomputer readable media, such as memory 106 or persistent storage 108.

Program code 118 is located in a functional form on computer readablemedia 120 that is selectively removable and may be loaded onto ortransferred to data processing system 100 for execution by processorunit 104. Program code 118 and computer readable media 120 form computerprogram product 122 in these examples. In one example, computer readablemedia 120 may be in a tangible form, such as, for example, an optical ormagnetic disc that is inserted or placed into a drive or other devicethat is part of persistent storage 108 for transfer onto a storagedevice, such as a hard drive that is part of persistent storage 108. Ina tangible form, computer readable media 120 also may take the form of apersistent storage, such as a hard drive, a thumb drive, or a flashmemory that is connected to data processing system 100. The tangibleform of computer readable media 120 is also referred to as computerrecordable storage media. In some instances, computer readable media 120may not be removable.

Alternatively, program code 118 may be transferred to data processingsystem 100 from computer readable media 120 through a communicationslink to communications unit 110 and/or through a connection toinput/output unit 112. The communications link and/or the connection maybe physical or wireless in the illustrative examples. The computerreadable media also may take the form of non-tangible media, such ascommunications links or wireless transmissions containing the programcode.

In some illustrative embodiments, program code 118 may be downloadedover a network to persistent storage 108 from another device or dataprocessing system for use within data processing system 100. Forinstance, program code stored in a computer readable storage medium in aserver data processing system may be downloaded over a network from theserver to data processing system 100. The data processing systemproviding program code 118 may be a server computer, a client computer,or some other device capable of storing and transmitting program code118.

The different components illustrated for data processing system 100 arenot meant to provide architectural limitations to the manner in whichdifferent embodiments may be implemented. The different illustrativeembodiments may be implemented in a data processing system includingcomponents in addition to or in place of those illustrated for dataprocessing system 100. Other components shown in FIG. 1 can be variedfrom the illustrative examples shown. The different embodiments may beimplemented using any hardware device or system capable of executingprogram code. As one example, the data processing system may includeorganic components integrated with inorganic components and/or may becomprised entirely of organic components excluding a human being. Forexample, a storage device may be comprised of an organic semiconductor.

As another example, a storage device in data processing system 100 maybe any hardware apparatus that may store data. Memory 106, persistentstorage 108 and computer readable media 120 are examples of storagedevices in a tangible form.

In another example, a bus system may be used to implement communicationsfabric 102 and may be comprised of one or more buses, such as a systembus or an input/output bus. Of course, the bus system may be implementedusing any suitable type of architecture that provides for a transfer ofdata between different components or devices attached to the bus system.Additionally, a communications unit may include one or more devices usedto transmit and receive data, such as a modem or a network adapter.Further, a memory may be, for example, memory 106 or a cache such asfound in an interface and memory controller hub that may be present incommunications fabric 102.

According to an illustrative embodiment, a Java program objectinstantiated as an instance of a Java class inherits the intrinsicbehaviors and features of the Java class implementation. Inobject-oriented programming, instantiation refers to the creation of anactual instance, i.e., an object, using the class's template. Memory isallocated for the object, and the object receives its own copy of anyinstance variables. Using the data processing system 100 of FIG. 1 as anexample, an illustrative embodiment provides the computer-implementedprocess stored in memory 106, executed by the processor unit 104, forcreating enhanced Java arrays. The processor unit 104 executes thecomputer-implemented process to provide instrumentation to an enhancedruntime using an enhanced compiler for a computer executable programportion. Generally, instrumentation is the process of injecting codeinto a compiled program. In Java, instrumentation may include theaddition of functionality to a program by modifying the bytecode (i.e.,the output of the Java compiler) of one or more Java classes. Theprocessor unit 104 further detects a special class in the computerexecutable program portion using the enhanced runtime. The processorunit 104 instantiates the enhanced Java array with intrinsic behaviorsand features inherent in a Java class implementation.

In an alternative embodiment, program code 118 containing thecomputer-implemented process may be stored within computer readablemedia 120 as computer program product 122. In another illustrativeembodiment, the process for enhanced Java array creation may beimplemented in an apparatus comprising a communications fabric, a memoryconnected to the communications fabric, wherein the memory containscomputer executable program code, a communications unit connected to thecommunications fabric, an input/output unit connected to thecommunications fabric, a display connected to the communications fabric,and a processor unit connected to the communications fabric. Theprocessor unit of the apparatus executes the computer executable programcode to direct the apparatus to perform the process of enhanced Javaarray creation.

With reference to FIG. 2, a block diagram of an annotation system, inaccordance with various embodiments of the disclosure is presented.Annotation system 200 is an example of a portion of a data processingsystem for creating enhanced Java array instances, such as dataprocessing system 100 of FIG. 1, having the annotation systemincorporated within.

The annotation system 200, in the illustrative embodiment, includes anumber of components, leveraging support of an underlying dataprocessing system, comprising an enhanced compiler 202, an enhancedruntime 204, provided as an enhanced Java virtual machine (JVM), and anenhanced Java array class 206.

The enhanced Java array class 206 is a Java class comprising intrinsicbehaviors and features of the Java class implementation. In the Javaprogramming language, a class represents a blueprint definition fromwhich individual objects may be created. Therefore, the enhanced Javaarray class may include class variables, instance variables, localvariables, parameters, user-defined methods, inherited states andbehaviors, and interfaces, among other things. The illustrativeembodiment may be implemented using a Java programming language example,but the concepts presented may apply to other object orientedprogramming languages as well.

The enhanced compiler 202 provides a capability to generate an annotatedJava class definition and subsequently add instrumentation to theresultant Java class file (i.e., the output of a Java compiler) toindicate that an enhanced Java array class, in the form of a Java class,along with the intrinsic behaviors and features of the Java classimplementation, is defined. The enhanced Java array class may thereforebe defined using standard Java language semantics, annotated by theenhanced compiler 202, and instantiated by the enhanced runtime 204.However, where an enhanced runtime 204 is not provided, the instrumentedJava class file may still be supported in a less optimal fashion, withrespect to memory usage and performance.

The enhanced runtime 204 recognizes the Java array class instrumentationprovided by the enhanced compiler 202 and provides the intrinsic Javaclass operations. For example, the enhanced runtime providescapabilities to instantiate the enhanced Java array and access itselements.

An enhanced Java array class may be defined using the @ArrayClassannotation, and instrumented by the enhanced compiler 202 of theannotation system 200 of FIG. 2. For example, consider the followingJava class definition:

class Element { int field 1; int field 2; Element (int field1, intfield2) { this.field1 = field1; this.field2 = field2; } }

The corresponding enhanced Java array class may be generated by theenhanced compiler 202 of the annotation system 200, both of FIG. 2, asfollows:

@ArrayClass(type=Element.class) class ElementArray implementsSerializable, Cloneable { private ElementArray( ) { } public finalstatic ElementArray allocate(int length) { returnArrayClassInternals.newInstance(ElementArray.class, length); } publicfinal int getLength( ) { return ArrayClassInternals.getLength(this); }public final Element at(int index) { return ArrayClassInternals.at(this,index); } public final void put(int index, Element value) { returnArrayClassInternals.put(this, index, value); } // user defined methodsmay be added void userDefinedMethod( ) { // actions of the method } }

Additionally, when the enhanced Java array class, shown in the aboveexample as ElementArray, is generated by the enhanced compiler 202 ofthe annotation system 200 of FIG. 2, the user may extend the generatedJava class by defining custom methods, such as shown asuserDefinedMethod( ) in the above example.

Standard array-like operations on an instance of an enhanced Java arrayclass, such as ElementArray, may be implemented in a helper class by anenhanced runtime 204 of the annotation system 200 of FIG. 2. Forexample, ArrayClassInternals provides the following methods to createthe class instance, get the length of the array, retrieve an arrayelement, and set the value of an array element:

public final class ArrayClassInternals { public static native <T> TnewInstance(Class<T>, int length); public static native intgetLength(Object array); public static native Object at(Object array,int index); public static native void put(Object array, int index,Object value); }

Subsequently, the ArrayClassInternals may be used to express operationsinvolving an enhanced Java array class, such as ElementArray, instandard Java language code as follows:

// instantiate an ElementArray ElementArray array =ElementArray.allocate(10); // assign the value of an element of theElementArray instance Element e = new Element(0); array.put(0, e); //retrieve an element of the ElementArray instance e = array.at(0); //call user-defined method array.userDefinedMethod( );

The methods of ArrayClassInternals may be implemented, for example, instandard Java language code. Another example implementation may use theJava Native Interface (JNI), which is an application program interface(API) that enables Java code in a JVM to interface with a non-Javaenvironment. However, this implementation requires knowledge of theinternal virtual machine representation of the enhanced Java array classand its instance(s). For Just-In-Time (JIT) compiled Java code, when thetype of the enhanced Java array instance can be determined at compiletime, the JIT can generate optimized code that is specific to the typeof the enhanced Java array instance. JIT compilation is translation ofJava bytecode into machine code that is done during the execution of aprogram, i.e., at run time, rather than prior to execution. Anotheralternative includes using the sun.misc.Unsafe API, which providesfunctions to directly read and write to arbitrary memory locations.However, this alternative circumvents published Java language and APIspecifications.

In operation, during class loading the enhanced runtime 204 of FIG. 2(i.e., the JVM) recognizes the @ArrayClass annotation. The enhanced Javaarray class (i.e., ElementArray) is associated with the class of thearray's elements (i.e., Element). The enhanced runtime 204 of FIG. 2also ensures the class of the array's elements (i.e., Element) isloaded. However, in other respects, such as method table building, andinheriting methods from superclasses and interfaces, the enhanced Javaarray class inherits the intrinsic behaviors and features of the Javaclass implementation.

In the absence of the @ArrayClass annotation, a typical Java class isinstantiated as a singleton object, for example 300 (FIG. 3A), which isa single entity that comprises storage for a single copy of eachinstance variable declared in the Java class definition 305 (FIG. 3A).In contrast, when an enhanced Java array class is instantiated, the@ArrayClass annotation directs the enhanced runtime 204 of FIG. 2 (JVM)to instantiate it as an array object of its element class, which we willhereafter refer to as simply an array object. In the example depicted in310 (FIG. 3B), an array object differs from a non-array object in thatthe array object comprises zero or more element entities 315 (FIG. 3B),where each element is an instance of the array object's element class320 (FIG. 3B). The array object has a length 325 (FIG. 3B), which is anintegral (i.e., an integer) value greater than or equal to zero thatspecifies the number of elements. Also, the array object comprisesstorage for length copies of each instance variable 330 (FIG. 3B)declared in its elements' class definition. Each element is accessedusing a numerical index. The enhanced runtime 204 of FIG. 2 (JVM) usesthe information associated with the class of the enhanced array class'selements, particularly the size of an instance of the element class, toallocate the enhanced array instance's data. The garbage collectionprocess also uses the array length and element size information tocorrectly manage the memory of the enhanced array.

The location and layout of the enhanced array instance's data isgoverned by the implementation of the ArrayClassInternals helper class.If the enhanced runtime also supports a mechanism for optimizing thememory layout of class instances, the mechanism can be used to optimizethe memory layout of the enhanced array instance. There are manypossible mechanisms for optimizing the memory layout of class instances,such as, for example, a packed data object. The packed data object modeldiffers from the standard Java data model, in several ways, but ingeneral, data is stored in the minimum amount of space necessary.

With reference to FIG. 4, a process for creating an enhanced Java array,using the annotation system of FIG. 2, in accordance with one embodimentof the disclosure is presented.

At 410, an enhanced compiler generates an instrumented class file for anenhanced array class, which specifies its element class. Generating theinstrumented class file further comprises receiving a source code filethat is written in a programming language. At least one annotation isembedded in the class file generated from the programming languagesource code file, wherein an annotation comprises one or more directivesthat guide the execution of at least one of: an enhanced runtime; andthe one or more helper libraries. For example, a directive @ArrayClassis used to inform the enhanced runtime of the special class, theenhanced Java array class.

At 420, the enhanced runtime loads the instrumented class file,generated in 410, corresponding to the enhanced array class. At 430, theenhanced runtime loads the class file corresponding to the class of theelements of the enhanced array.

At 440, the enhanced runtime builds an internal data structurecorresponding to the enhanced array class.

At 450, the enhanced runtime calculates the amount of memory storagerequired for the enhanced array instance. Calculating the amount ofmemory storage further comprises multiplying a size of the data elementof the enhanced array by a number of elements to be stored in the array.The size of metadata, used by the enhanced runtime to manage the arraydata is added to the calculated size of the array data element storage.The term, metadata, is implementation-specific. However, generally inthis context, metadata refers to data used by the enhanced runtime,i.e., the JVM, to manage the array data. An amount of additional storageis then added, as required by the runtime. At 460, the enhanced runtimeallocates the amount of memory, calculated at 450.

Thus in one illustrative embodiment, a computer-implemented processcreates an enhanced array. The computer-implemented process generates aninstrumented class file for an enhanced array, loads the instrumentedclass file that corresponds to the enhanced array class, loads the classfile corresponding to the element class of the enhanced array. Thecomputer-implemented process builds an internal data structurecorresponding to the enhanced array class, calculates an amount ofmemory storage required to store an instance of the enhanced arrayclass, and allocates the calculated amount of memory for the instance ofthe enhanced array class. The amount of memory is calculated as the sizeof an element of the array multiplied by a number of elements in thearray, plus the total size of metadata and additional storage requiredby the runtime.

Referring now to FIG. 5, computing device 500 may include respectivesets of internal components 800 and external components 900 thattogether may provide an environment for a software application, such asa database management system (DBMS). Each of the sets of internalcomponents 800 includes one or more processors 820; one or morecomputer-readable RAMs 822; one or more computer-readable ROMs 824 onone or more buses 826; one or more operating systems 828; one or moresoftware applications (e.g., Java development and runtime modules 829)executing the method 600; and one or more computer-readable tangiblestorage devices 830. The one or more operating systems 828 and Javadevelopment and runtime modules 829 are stored on one or more of therespective computer-readable tangible storage devices 830 for executionby one or more of the respective processors 820 via one or more of therespective RAMs 822 (which typically include cache memory). In theembodiment illustrated in FIG. 5, each of the computer-readable tangiblestorage devices 830 is a magnetic disk storage device of an internalhard drive. Alternatively, each of the computer-readable tangiblestorage devices 830 is a semiconductor storage device such as ROM 824,EPROM, flash memory or any other computer-readable tangible storagedevice that can store a computer program and digital information.

Each set of internal components 800 also includes a R/W drive orinterface 832 to read from and write to one or more computer-readabletangible storage devices 936 such as a CD-ROM, DVD, SSD, memory stick,magnetic tape, magnetic disk, optical disk or semiconductor storagedevice.

Each set of internal components 800 may also include network adapters(or switch port cards) or interfaces 836 such as a TCP/IP adapter cards,wireless WI-FI interface cards, or 3G or 4G wireless interface cards orother wired or wireless communication links. The DBMS modules 829, andoperating system 828 that are associated with computing device 500, canbe downloaded to computing device 500 from an external computer (e.g.,server) via a network (for example, the Internet, a local area network,or other wide area network) and respective network adapters orinterfaces 836. From the network adapters (or switch port adapters) orinterfaces 836 and operating system 828 associated with computing device500 are loaded into the respective hard drive 830 and network adapter836. The network may comprise copper wires, optical fibers, wirelesstransmission, routers, firewalls, switches, gateway computers and/oredge servers.

Each of the sets of external components 900 can include a computerdisplay monitor 920, a keyboard 930, and a computer mouse 934. Externalcomponents 900 can also include touch screens, virtual keyboards, touchpads, pointing devices, and other human interface devices. Each of thesets of internal components 800 also includes device drivers 840 tointerface to computer display monitor 920, keyboard 930 and computermouse 934. The device drivers 840, R/W drive or interface 832 andnetwork adapter or interface 836 comprise hardware and software (storedin storage device 830 and/or ROM 824).

Various embodiments of the invention may be implemented in a dataprocessing system suitable for storing and/or executing program codethat includes at least one processor coupled directly or indirectly tomemory elements through a system bus. The memory elements include, forinstance, local memory employed during actual execution of the programcode, bulk storage, and cache memory which provide temporary storage ofat least some program code in order to reduce the number of times codemust be retrieved from bulk storage during execution.

Input/Output or I/O devices (including, but not limited to, keyboards,displays, pointing devices, DASD, tape, CDs, DVDs, thumb drives andother memory media, etc.) can be coupled to the system either directlyor through intervening I/O controllers. Network adapters may also becoupled to the system to enable the data processing system to becomecoupled to other data processing systems or remote printers or storagedevices through intervening private or public networks. Modems, cablemodems, and Ethernet cards are just a few of the available types ofnetwork adapters.

The present invention may be a system, a method, and/or a computerprogram product. The computer program product may include a computerreadable storage medium (or media) having computer readable programinstructions thereon for causing a processor to carry out aspects of thepresent invention.

The computer readable storage medium can be a tangible device that canretain and store instructions for use by an instruction executiondevice. The computer readable storage medium may be, for example, but isnot limited to, an electronic storage device, a magnetic storage device,an optical storage device, an electromagnetic storage device, asemiconductor storage device, or any suitable combination of theforegoing. A non-exhaustive list of more specific examples of thecomputer readable storage medium includes the following: a portablecomputer diskette, a hard disk, a random access memory (RAM), aread-only memory (ROM), an erasable programmable read-only memory (EPROMor Flash memory), a static random access memory (SRAM), a portablecompact disc read-only memory (CD-ROM), a digital versatile disk (DVD),a memory stick, a floppy disk, a mechanically encoded device such aspunch-cards or raised structures in a groove having instructionsrecorded thereon, and any suitable combination of the foregoing. Acomputer readable storage medium, as used herein, is not to be construedas being transitory signals per se, such as radio waves or other freelypropagating electromagnetic waves, electromagnetic waves propagatingthrough a waveguide or other transmission media (e.g., light pulsespassing through a fiber-optic cable), or electrical signals transmittedthrough a wire.

Computer readable program instructions described herein can bedownloaded to respective computing/processing devices from a computerreadable storage medium or to an external computer or external storagedevice via a network, for example, the Internet, a local area network, awide area network and/or a wireless network. The network may comprisecopper transmission cables, optical transmission fibers, wirelesstransmission, routers, firewalls, switches, gateway computers and/oredge servers. A network adapter card or network interface in eachcomputing/processing device receives computer readable programinstructions from the network and forwards the computer readable programinstructions for storage in a computer readable storage medium withinthe respective computing/processing device.

Computer readable program instructions for carrying out operations ofthe present invention may be assembler instructions,instruction-set-architecture (ISA) instructions, machine instructions,machine dependent instructions, microcode, firmware instructions,state-setting data, or either source code or object code written in anycombination of one or more programming languages, including an objectoriented programming language such as Smalltalk, C++ or the like, andconventional procedural programming languages, such as the “C”programming language or similar programming languages. The computerreadable program instructions may execute entirely on the user'scomputer, partly on the user's computer, as a stand-alone softwarepackage, partly on the user's computer and partly on a remote computeror entirely on the remote computer or server. In the latter scenario,the remote computer may be connected to the user's computer through anytype of network, including a local area network (LAN) or a wide areanetwork (WAN), or the connection may be made to an external computer(for example, through the Internet using an Internet Service Provider).In some embodiments, electronic circuitry including, for example,programmable logic circuitry, field-programmable gate arrays (FPGA), orprogrammable logic arrays (PLA) may execute the computer readableprogram instructions by utilizing state information of the computerreadable program instructions to personalize the electronic circuitry,in order to perform aspects of the present invention.

Aspects of the present invention are described herein with reference toflowchart illustrations and/or block diagrams of methods, apparatus(systems), and computer program products according to embodiments of theinvention. It will be understood that each block of the flowchartillustrations and/or block diagrams, and combinations of blocks in theflowchart illustrations and/or block diagrams, can be implemented bycomputer readable program instructions.

These computer readable program instructions may be provided to aprocessor of a general purpose computer, special purpose computer, orother programmable data processing apparatus to produce a machine, suchthat the instructions, which execute via the processor of the computeror other programmable data processing apparatus, create means forimplementing the functions/acts specified in the flowchart and/or blockdiagram block or blocks. These computer readable program instructionsmay also be stored in a computer readable storage medium that can directa computer, a programmable data processing apparatus, and/or otherdevices to function in a particular manner, such that the computerreadable storage medium having instructions stored therein comprises anarticle of manufacture including instructions which implement aspects ofthe function/act specified in the flowchart and/or block diagram blockor blocks.

The computer readable program instructions may also be loaded onto acomputer, other programmable data processing apparatus, or other deviceto cause a series of operational steps to be performed on the computer,other programmable apparatus or other device to produce a computerimplemented process, such that the instructions which execute on thecomputer, other programmable apparatus, or other device implement thefunctions/acts specified in the flowchart and/or block diagram block orblocks.

The flowchart and block diagrams in the Figures illustrate thearchitecture, functionality, and operation of possible implementationsof systems, methods, and computer program products according to variousembodiments of the present invention. In this regard, each block in theflowchart or block diagrams may represent a module, segment, or portionof instructions, which comprises one or more executable instructions forimplementing the specified logical function(s). In some alternativeimplementations, the functions noted in the block may occur out of theorder noted in the figures. For example, two blocks shown in successionmay, in fact, be executed substantially concurrently, or the blocks maysometimes be executed in the reverse order, depending upon thefunctionality involved. It will also be noted that each block of theblock diagrams and/or flowchart illustration, and combinations of blocksin the block diagrams and/or flowchart illustration, can be implementedby special purpose hardware-based systems that perform the specifiedfunctions or acts or carry out combinations of special purpose hardwareand computer instructions.

Although preferred embodiments have been depicted and described indetail herein, it will be apparent to those skilled in the relevant artthat various modifications, additions, substitutions and the like can bemade without departing from the spirit of the disclosure, and these are,therefore, considered to be within the scope of the disclosure, asdefined in the following claims.

1-13. (canceled)
 14. A computer system for creating an enhanced arrayclass comprising one or more processors, one or more computer-readablestorage devices, and a plurality of program instructions stored on atleast one of the one or more storage devices for execution by at leastone of the one or more processors, the plurality of program instructionscomprising: a physical computer readable storage memory readable by aprocessing circuit and storing instructions for execution by theprocessing circuit for performing a method comprising: generating, by anenhanced compiler, an instrumented class file for an enhanced arrayclass, wherein the enhanced array class comprises at least one elementclass; loading, by an enhanced runtime, the instrumented class file,wherein the instrumented class file corresponds to the enhanced arrayclass; loading, by the enhanced runtime, a class file corresponding tothe at least one element class of the enhanced array class; building, bythe enhanced runtime, an internal data structure corresponding to theenhanced array class, wherein each element of the internal datastructure corresponds to an instance of the element class of theenhanced array class; calculating, by the enhanced runtime, an amount ofmemory storage required to store an instance of the enhanced arrayclass, wherein calculating the amount memory storage required to storethe enhanced array instance comprises: multiplying a size of the dataelement of the enhanced array by a number of data elements to be storedin the enhanced array, adding a total size of metadata, and adding anamount of additional storage as required by the runtime; and allocating,by the enhanced runtime, the calculated amount of memory storagerequired to store the instance of the enhanced array class.
 15. Thecomputer system of claim 14, wherein the enhanced runtime comprises atleast one of: an enhanced virtual machine, wherein based on the presenceof the enhanced array class instrumentation, the enhanced virtualmachine instantiates the enhanced array class as an array object; andone or more helper libraries, wherein the one or more helper librariesinstantiate the enhanced array class as an array object, based on thepresence of the enhanced array class instrumentation, and based on avirtual machine not being an enhanced virtual machine.
 16. The method ofclaim 14, wherein a mechanism to instantiate the enhanced array class asthe array object uses an optimal memory layout mechanism that isprovided by an enhanced virtual machine.
 17. (canceled)
 18. The computersystem product of claim 14, wherein generating the instrumented classfile comprises: receiving a programming language source code file;embedding at least one annotation in the class file generated from theprogramming language source code file, wherein an annotation comprisesone or more directives that guide the execution of at least one of: theenhanced runtime; and the one or more helper libraries.
 19. The computersystem of claim 14, further comprising a virtual machine, wherein thevirtual machine reclaims on-heap objects during garbage collectionoperations, based on an array length and element size of the enhancedarray class; and generated, by a Just-In-Time (JIT) compiler, optimizedcode sequences for operations associated with enhanced arrays.
 20. Thecomputer system of claim 14, further comprising: optimized codesequences, generated by a Just-In-Time (JIT) compiler, for operationsassociated with enhanced arrays.
 21. A computer program product forcreating an enhanced array comprising: a physical computer readablestorage memory readable by a processing circuit and storing instructionsfor execution by the processing circuit for performing a methodcomprising: generating, by an enhanced compiler, an instrumented classfile for an enhanced array class, wherein the enhanced array classcomprises at least one element class; loading, by an enhanced runtime,the instrumented class file, wherein the instrumented class filecorresponds to the enhanced array class; loading, by the enhancedruntime, a class file corresponding to the at least one element class ofthe enhanced array class; building, by the enhanced runtime, an internaldata structure corresponding to the enhanced array class, wherein eachelement of the internal data structure corresponds to an instance of theelement class of the enhanced array class; calculating, by the enhancedruntime, an amount of memory storage required to store an instance ofthe enhanced array class, wherein calculating the amount of memorystorage required to store the enhanced array instance comprises:multiplying a size of the data element of the enhanced array by a numberof data elements to be stored in the enhanced array; adding a total sizeof metadata; and adding an amount of additional storage as required bythe runtime; and allocating, by the enhanced runtime, the calculatedamount of memory storage required to store the instance of the enhancedarray class.
 22. The computer program product of claim 21, wherein theenhanced runtime comprises at least one of: an enhanced virtual machine,wherein based on the presence of the enhanced array classinstrumentation, the enhanced virtual machine instantiates the enhancedarray class as an array object; and one or more helper libraries,wherein the one or more helper libraries instantiate the enhanced arrayclass as an array object, based on the presence of the enhanced arrayclass instrumentation, and based on a virtual machine not being anenhanced virtual machine.
 23. The computer program product of claim 21,wherein a mechanism to instantiate the enhanced array class as the arrayobject uses an optimal memory layout mechanism that is provided by anenhanced virtual machine.
 24. The computer program product of claim 21,wherein generating the instrumented class file comprises: receiving aprogramming language source code file; embedding at least one annotationin the class file generated from the programming language source codefile, wherein an annotation comprises one or more directives that guidethe execution of at least one of: the enhanced runtime; and the one ormore helper libraries.
 25. The computer program product of claim 21,further comprising a virtual machine, wherein the virtual machinereclaims on-heap objects during garbage collection operations, based onan array length and element size of the enhanced array class.
 26. Thecomputer program product of claim 21, further comprising: optimized codesequences, generated by a Just-In-Time (JIT) compiler, for operationsassociated with enhanced arrays.